package com.zsy.petshop_01.controller;

import com.zsy.petshop_01.common.result.ResponseResult;
import com.zsy.petshop_01.model.vo.subscribe.AnswerVo;
import com.zsy.petshop_01.model.vo.subscribe.SubscribeVo;
import com.zsy.petshop_01.service.SubscribeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "预约管理")
@RestController
@RequestMapping("/subscribe")
public class SubscribeController {
    @Autowired
    SubscribeService subscribeService;

    @ApiOperation("预约")
    @PostMapping("/subscribe")
    public ResponseResult<?> subscribe(@RequestBody SubscribeVo subscribeVo, HttpServletRequest request){
        return subscribeService.subscribe(subscribeVo,request);
    }

    @ApiOperation("查询当天预约")
    @GetMapping("/selectSubscribeInDay")
    public ResponseResult<?> selectSubscribeInDay(@RequestParam("time") String time){
        return subscribeService.selectSubscribeInDay(time);
    }

    @ApiOperation("查询我的预约")
    @GetMapping("/selectSubscribeByUserId")
    public ResponseResult<?> selectSubscribeByUserId(HttpServletRequest request){
        return subscribeService.selectSubscribeByUserId(request);
    }

    @ApiOperation("查询预约详情")
    @GetMapping("/selectSubscribeByMorning")
    public ResponseResult<?> selectSubscribeByMorning(@RequestParam("id") Integer id,@RequestParam("isMorning") Boolean isMorning){
        return subscribeService.selectSubscribeByMorning(id,isMorning);
    }

    @ApiOperation("店主回复")
    @PostMapping("/ownerAnswer")
    public ResponseResult<?> ownerAnswer(@RequestBody AnswerVo answerVo){
        return subscribeService.ownerAnswer(answerVo);
    }

}
